package cn.demoncat.util.pay.yeepay.entity;

import cn.demoncat.util.pay.yeepay.constant.MerchantRegisterStatus;

/**
 * 响应参数-商户入网申请查询
 *
 * @author 延晓磊
 * @since 2020年10月17日
 */
public class MerchantRegisterQueryResult extends YeepayResult{

    // 申请号（请求方）
    private String requestNo;
    // 申请单号
    private String applicationNo;
    // 申请状态：MerchantRegisterStatus.name()
    private String applicationStatus;
    // 商户编号
    private String merchantNo;
    // 审核意见：“申请已驳回”或“申请已完成”时，回传的审核意见
    private String auditOpinion;

    /**
     * 构建结果
     *
     * @param other 请求结果
     * @return
     */
    public static MerchantRegisterQueryResult build(YeepayResult other){
        return build(other.check("returnCode", "returnMsg", "NIG00000"), MerchantRegisterQueryResult.class);
    }

    /**
     * 申请状态
     *
     * @return
     */
    public MerchantRegisterStatus applicationStatus(){
        if (this.applicationStatus != null) {
            return MerchantRegisterStatus.valueOf(this.applicationStatus);
        }
        return null;
    }

    public String getRequestNo() {
        return requestNo;
    }

    public void setRequestNo(String requestNo) {
        this.requestNo = requestNo;
    }

    public String getApplicationNo() {
        return applicationNo;
    }

    public void setApplicationNo(String applicationNo) {
        this.applicationNo = applicationNo;
    }

    public String getApplicationStatus() {
        return applicationStatus;
    }

    public void setApplicationStatus(String applicationStatus) {
        this.applicationStatus = applicationStatus;
    }

    public String getMerchantNo() {
        return merchantNo;
    }

    public void setMerchantNo(String merchantNo) {
        this.merchantNo = merchantNo;
    }

    public String getAuditOpinion() {
        return auditOpinion;
    }

    public void setAuditOpinion(String auditOpinion) {
        this.auditOpinion = auditOpinion;
    }

}
